package com.liusaidh.utils;

import com.liusaidh.domain.User;

import java.time.LocalDateTime;
import java.util.Random;

/**
 * @author liusaidh
 * @date 2024/7/18 21:30
 * @description  产生一些随机数
 */
public class RandomUtil {

    public static final String DEFAULT_AVATAR_URL = "https://weibo-img.oss-cn-beijing.aliyuncs.com/defaultAvatar.png";

    /**
     * 根据邮箱和密码 返回一个随机的用户
     * @param email
     * @param password
     * @return
     */
    public static User getRandomUser(String email,String password){
        return new User(getRandomUsername(), password, email, 0,
                0, 0, 0,DEFAULT_AVATAR_URL , getLocalTime(), 0);
    }

    /**
     * 产生随机的用户名
     * @return  user_9位数
     */
    public static String getRandomUsername(){
        return "user_" + (new Random().nextInt(100000000) + 100000000);
    }

    /**
     * 返回当前的时间
     * @return  时分秒
     */
    public static String getLocalTime(){
        return LocalDateTime.now().toString();
    }
}
